package client;

//~--- non-JDK imports --------------------------------------------------------

import coins.SimulationSession;

import com.dukascopy.api.IStrategy;
import com.dukascopy.api.Period;

import strategies.AdaptiveTakeProfitStrategy;
import strategies.StrategyArgs;

//~--- JDK imports ------------------------------------------------------------

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public class Main {

    // password
    private static String password = "letmein";

    // database url
    private static String url = "jdbc:mysql://10.0.0.3/jforex";

    // login name
    private static String userName = "root";

    public static void main(String[] args) throws Exception {

        // Create the strategy arguments for testing
        Calendar           start     = Calendar.getInstance();
        List<StrategyArgs> arguments = new ArrayList<StrategyArgs>();

        arguments.add(new StrategyArgs(10, 900, 0, 1, Period.ONE_HOUR, "2006-09-01 00:00:00", "2011-05-09 23:59:59",
                                          30, 1000, .003, .01, .02, true));

        SimulationSession session    = null;
        List<IStrategy>   strategies = new ArrayList<IStrategy>();

        for (StrategyArgs a : arguments) {
            AdaptiveTakeProfitStrategy strategy = new AdaptiveTakeProfitStrategy(a);

            // Strategy strategy = new DummyStrategy(a, true, "db");
            strategies.add(strategy);
        }

        session = new SimulationSession(url, userName, password, arguments.get(0).getStartDate(),
                                        arguments.get(0).getEndDate(), arguments.get(0).getInitialDeposit(),
                                        arguments.get(0).getLeverage(), strategies, arguments.get(0).getPeriod());
        session.useFileSystem = true;
        session.start();

        /*
         * JOptionPane.showMessageDialog(null, (Calendar.getInstance()
         * .getTimeInMillis() - start.getTimeInMillis()) / 1000);
         */
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
